/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//		File Name		:		VIN_AnimationManager.cpp
//
//		Author			:		Vindicated Games
//
//		Purpose			:		A header for all functions and members of the Animation Manager
//
//		Dates			:		Written( Feb 12, 2011 ) by Vindicated Games		LastUpdate( Feb 17, 2011  ) by Vindicated Games 
//	
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "VIN_AnimationManager.h"
#include "../tinyxml/tinyxml.h"

VIN_AnimationManager::VIN_AnimationManager()
{





}
VIN_AnimationManager::~VIN_AnimationManager()
{





}


VIN_AnimationManager* VIN_AnimationManager::GetInstance()
{

	static VIN_AnimationManager instance;
	return &instance;
}
void VIN_AnimationManager::InitAM()
{

}


//bool VIN_AnimationManager::Load( const char* AnimInfo)
//{
//	int tempID;
//
//	TiXmlDocument doc;
//
//	if(doc.LoadFile(AnimInfo) == false)
//		return false;
//
//	TiXmlElement* Root = doc.RootElement();
//	if(Root == NULL)
//		return false;
//
//	TiXmlElement* NumAnim = Root->FirstChildElement("xNumOfAnim");
//	int count = atoi(NumAnim->GetText());
//
//	TiXmlElement* ImageFile = Root->FirstChildElement("xImageFile");
//	if(ImageFile)
//	{
//		tempID = CSGD_TextureManager::GetInstance()->LoadTexture(ImageFile->GetText());
//	}
//
//	TiXmlElement* xAnimation  = Root->FirstChildElement("xAnimation");
//
//	while(xAnimation)
//	{
//		CAnimation a;
//
//		TiXmlElement* NumFrame = xAnimation->FirstChildElement("xNumOfFrames");
//		int fcount = atoi(NumFrame->GetText());
//
//		TiXmlElement* looping = xAnimation->FirstChildElement("xLooping");
//		a.SetIsLooping((bool)(atoi(looping->GetText())));
//
//		TiXmlElement* AnimSpd = xAnimation->FirstChildElement("xAnimSpd");
//		a.SetSpeed((float)( atoi(AnimSpd->GetText())));
//
//		TiXmlElement* xFrame = xAnimation->FirstChildElement("xFrame");
//
//		Frame temp;
//		temp.fTime = 0;
//		temp.ptAnchor.x = 0;
//		temp.ptAnchor.y = 0;
//
//		SetRect(&temp.rAttack,0,0,0,0);
//		SetRect(&temp.rCollision,0,0,0,0);
//		SetRect(&temp.rRender,0,0,0,0);
//
//		temp.ptAnchor.x = 0;
//		temp.ptAnchor.y = 0;
//
//
//		while(xFrame)
//		{
//			TiXmlElement* xTime = xFrame->FirstChildElement("xTime");
//			if(xTime)
//			{
//				temp.fTime =(float)( atoi(xTime->GetText()) );
//			}
//			TiXmlElement* FrameType = xFrame->FirstChildElement("xFrameType");
//			if(FrameType)
//			{
//				TiXmlElement* RenderFrame = FrameType->FirstChildElement("xRenderFrame");
//				if(RenderFrame)
//				{
//					TiXmlElement* RenderFrameX = RenderFrame->FirstChildElement("xRenderFrameX");
//					if(RenderFrameX)
//						temp.rRender.left =  atoi(RenderFrameX->GetText());
//
//					TiXmlElement* RenderFrameY = RenderFrame->FirstChildElement("xRenderFrameY");
//					if(RenderFrameY)
//						temp.rRender.top = atoi(RenderFrameY->GetText());
//
//					TiXmlElement* RenderFrameW = RenderFrame->FirstChildElement("xRenderFrameW");
//					if(RenderFrameW)
//					{
//						temp.rRender.right = atoi(RenderFrameW->GetText());
//						temp.rRender.right += temp.rRender.left;
//					}
//
//					TiXmlElement* RenderFrameH = RenderFrame->FirstChildElement("xRenderFrameH");
//					if(RenderFrameH)
//					{
//						temp.rRender.bottom = atoi(RenderFrameH->GetText());
//						temp.rRender.bottom += temp.rRender.top;
//					}
//				}
//
//				TiXmlElement* CollisionFrame = FrameType->FirstChildElement("xCollisionFrame");
//				if(CollisionFrame)
//				{
//					TiXmlElement* CollisionFrameX = CollisionFrame->FirstChildElement("xCollisionFrameX");
//					if(CollisionFrameX)
//						temp.rCollision.left = atoi(CollisionFrameX->GetText());
//
//					TiXmlElement* CollisionFrameY = CollisionFrame->FirstChildElement("xCollisionFrameY");
//					if(CollisionFrameY)
//						temp.rCollision.top = atoi(CollisionFrameY->GetText());
//
//					TiXmlElement* CollisionFrameW = CollisionFrame->FirstChildElement("xCollisionFrameW");
//					if(CollisionFrameW)
//						temp.rCollision.right = atoi(CollisionFrameW->GetText());
//
//					TiXmlElement* CollisionFrameH = CollisionFrame->FirstChildElement("xCollsionFrameH");
//					if(CollisionFrameH)
//						temp.rCollision.bottom = atoi(CollisionFrameH->GetText());
//				}
//
//				TiXmlElement* AttackFrame = FrameType->FirstChildElement("xAttackFrame");
//				if(AttackFrame)
//				{
//					TiXmlElement* AttackFrameX = AttackFrame->FirstChildElement("xAttackFrameX");
//					if(AttackFrameX)
//						temp.rAttack.left = atoi(AttackFrameX->GetText());
//
//					TiXmlElement* AttackFrameY = AttackFrame->FirstChildElement("xAttackFrameY");
//					if(AttackFrameY)
//						temp.rAttack.top = atoi(AttackFrameY->GetText());
//
//					TiXmlElement* AttackFrameW = AttackFrame->FirstChildElement("xAttackFrameW");
//					if(AttackFrameW)
//						temp.rAttack.right = atoi(AttackFrameW->GetText());
//
//					TiXmlElement* AttackFrameH = AttackFrame->FirstChildElement("xAttackFrameH");
//					if(AttackFrameH)
//						temp.rAttack.bottom = atoi(AttackFrameH->GetText());
//				}
//
//				TiXmlElement* AnchorPoint = FrameType->FirstChildElement("xAnchorPoint");
//				if(AnchorPoint)
//				{
//					TiXmlElement* AnchorPointX = AnchorPoint->FirstChildElement("xAnchorPointX");
//					if(AnchorPointX)
//					{
//						int ax = atoi(AnchorPointX->GetText());
//						temp.ptAnchor.x =  ax - temp.rRender.left;
//					}
//
//					TiXmlElement* AnchorPointY = AnchorPoint->FirstChildElement("xAnchorPointY");
//					if(AnchorPointY)
//					{
//						int ay = atoi(AnchorPointY->GetText());
//						temp.ptAnchor.y = ay - temp.rRender.top;
//					}
//				}
//			}
//			a.SetTimeDelay(temp.fTime);
//
//			temp.rAttack.right +=  temp.rAttack.left;
//			temp.rAttack.bottom += temp.rAttack.top;
//			temp.rAttack.left -= (temp.ptAnchor.x + temp.rRender.left);
//			temp.rAttack.top -= (temp.ptAnchor.y + temp.rRender.top);
//			temp.rAttack.right -= (temp.ptAnchor.x + temp.rRender.left);
//			temp.rAttack.bottom -=(temp.ptAnchor.y + temp.rRender.top);
//
//
//
//			temp.rCollision.right +=  temp.rCollision.left;
//			temp.rCollision.bottom += temp.rCollision.top;
//			temp.rCollision.left -= (temp.ptAnchor.x + temp.rRender.left);
//			temp.rCollision.top -= (temp.ptAnchor.y + temp.rRender.top);
//			temp.rCollision.right -= (temp.ptAnchor.x + temp.rRender.left);
//			temp.rCollision.bottom -=(temp.ptAnchor.y + temp.rRender.top);
//
//
//			a.addFrame(temp);
//			xFrame = xFrame->NextSiblingElement("xFrame");
//		}
//		a.SetImageID(tempID);
//		vAnimation.push_back(a);
//
//		xAnimation = xAnimation->NextSiblingElement("xAnimation");
//
//
//
//	}
//
//
//
//	return true;
//
//}
